--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
android/README.md list (284c333a) Text, 5.37 KB
Tc9d1d9# MeshChatX Android App
This directory contains the Android app build configuration using Chaquopy to embed the Python MeshChatX server.
Tc9d1d9## Architecture
The app uses a **WebView** to display the existing Vue.js frontend. The Python server runs in the background via Chaquopy and serves the web interface on Ta5d6ff`https://127.0.0.1:8000`.
Tc9d1d9## Build debug APK
Prerequisites:
Tff7b72- **JDK 17 or newer** (required by the Android Gradle Plugin used in this project). On distributions with multiple JDKs, point the build at JDK 17+ (for example Ta5d6ff`JAVA_HOME` for the Gradle invocation).
Tff7b72- **Android SDK** with API **34** platform and **Build-Tools 34** installed. Set Ta5d6ff`ANDROID_HOME` and Ta5d6ff`ANDROID_SDK_ROOT` to the SDK root (the same directory for both is fine).
Tff7b72- **`android/vendor/`** must contain the Chaquopy vendor wheels (see [Tff7b72Updating Android Python ABI Wheels](Te6edf3#updating-android-python-abi-wheels-python-311)). The build fails fast if this directory is missing or incomplete.
Tff7b72- **MeshChatX Python sources** at the repository root (Ta5d6ff`meshchatx/`). The build syncs them into the app before compiling.
SDK licenses:
Tff7b72- Use **Command-line Tools** Ta5d6ff`sdkmanager`, not the legacy Ta5d6ff`tools/bin/sdkmanager` from old SDK layouts. The legacy tool loads JAXB classes that were removed from the JDK in Java 11, so running it on JDK 17+ fails with Ta5d6ff`NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema`.
Tff7b72- Install Command-line Tools if needed: download the package for your OS from [Tff7b72Android Studio command-line tools](Te6edf3https://developer.android.com/studio#command-tools), extract it so you have Ta5d6ff`cmdline-tools/latest/bin/sdkmanager` under Ta5d6ff`ANDROID_HOME` (the inner folder is often named Ta5d6ff`latest`; see Google’s layout for that zip).
Tff7b72- Accept licenses (writes under the SDK; use sudo if the SDK is root-owned):
Ta5d6ff```Ta5d6fftext
yes | path/to/cmdline-tools/latest/bin/sdkmanager --licenses
Ta5d6ff```
Tff7b72- Install missing packages if the build still complains (platform 34, build-tools 34, etc.):
Ta5d6ff```Ta5d6fftext
path/to/cmdline-tools/latest/bin/sdkmanager "platforms;android-34" "build-tools;34.0.0"
Ta5d6ff```
Build from the Ta5d6ff`android/` directory:
Ta5d6ff```Ta5d6fftext
./gradlew assembleDebug
Ta5d6ff```
Debug APK outputs (ABI splits plus universal) are written under Ta5d6ff`app/build/outputs/apk/debug/`, for example:
Tff7b72- Ta5d6ff`app-arm64-v8a-debug.apk`
Tff7b72- Ta5d6ff`app-x86_64-debug.apk`
Tff7b72- Ta5d6ff`app-universal-debug.apk`
Tc9d1d9## Updating Android Python ABI Wheels (Python 3.11)
Use this workflow when a dependency (for example Ta5d6ff`cryptography`) requires custom Android wheels for Ta5d6ff`arm64-v8a` and Ta5d6ff`x86_64`.
Tff7b721. Build wheels in a Podman Python 3.11 container to avoid host Python mismatches:
Tff7b72- Use Ta5d6ff`docker.io/library/python:3.11-bookworm`.
Tff7b72- Mount project root to Ta5d6ff`/work` and Android SDK to Ta5d6ff`/opt/android-sdk`.
Tff7b72- Export Ta5d6ff`ANDROID_HOME` and Ta5d6ff`ANDROID_SDK_ROOT` to Ta5d6ff`/opt/android-sdk`.
Tff7b72- Example container entry:
Ta5d6ff`podman run --rm --network host -e ANDROID_HOME=/opt/android-sdk -e ANDROID_SDK_ROOT=/opt/android-sdk -v "/opt/android-sdk:/opt/android-sdk" -v "<repo>:/work" -w /work docker.io/library/python:3.11-bookworm bash`
Tff7b722. Keep custom Chaquopy recipes in Ta5d6ff`android/chaquopy-recipes/<package>-<major>/`:
Tff7b72- Define package/version in Ta5d6ff`meta.yaml`.
Tff7b72- Store source patches in Ta5d6ff`patches/`.
Tff7b723. Build both ABIs with Chaquopy Ta5d6ff`build-wheel.py` and place final wheels in Ta5d6ff`android/vendor/`.
Tff7b724. Update Ta5d6ff`android/app/build.gradle` Ta5d6ff`pip` installs to the new pinned version.
Tff7b725. Rebuild with Ta5d6ff`./gradlew assembleDebug` and verify split outputs:
Tff7b72- Ta5d6ff`app-arm64-v8a-debug.apk`
Tff7b72- Ta5d6ff`app-x86_64-debug.apk`
Tff7b72- Ta5d6ff`app-universal-debug.apk`
Notes:
Tff7b72- For Rust-backed wheels (such as modern Ta5d6ff`cryptography`), build inside the container with Rust toolchain available.
Tff7b72- Keep recipe files and patches versioned; keep generated build artifacts untracked.
Tc9d1d9## Custom Recipes and Patches
This project keeps Android-specific Chaquopy recipes in Ta5d6ff`android/chaquopy-recipes/` to bridge gaps between desktop Python dependencies and Android wheel availability.
Tff7b72- Ta5d6ff`cryptography-46`
Tff7b72- Purpose: provide Android ABI wheels for Ta5d6ff`cryptography 46.0.7` (Ta5d6ff`arm64-v8a`, Ta5d6ff`x86_64`) because upstream Chaquopy index only provided older builds.
Tff7b72- Ta5d6ff`patches/openssl_no_legacy.patch`: disables OpenSSL legacy provider loading, which is unavailable in the bundled Android OpenSSL runtime.
Tff7b72- Ta5d6ff`patches/pyo3_no_interpreter.patch`: enables compatible Ta5d6ff`pyo3` ABI settings for Chaquopy Python 3.11 Android builds.
Tff7b72- Ta5d6ff`aiohttp-3.13`
Tff7b72- Purpose: align Android with desktop dependency line (Ta5d6ff`aiohttp 3.13.3`) by building fresh ABI wheels with Chaquopy.
Tff7b72- No source patch is required; recipe pins the newer upstream version for Android wheel generation.
Tff7b72- Ta5d6ff`psutil-7.2`
Tff7b72- Purpose: align Android with desktop dependency line (Ta5d6ff`psutil 7.2.2`) while preserving Android runtime behavior.
Tff7b72- Ta5d6ff`patches/chaquopy.patch`: treats Ta5d6ff`android` platform as Linux in psutil internals and forces a safe partition enumeration path because Ta5d6ff`/proc/filesystems` can be restricted by SELinux on some Android API levels.
Tff7b72- Ta5d6ff`bcrypt-5`
Tff7b72- Purpose: tracks attempted upgrade path to desktop-equivalent bcrypt.
Tff7b72- Status: currently not enabled in Android app dependencies; Ta5d6ff`bcrypt==3.1.7` remains pinned for stable APK builds.
Tc9d1d9## License
This directory is part of the main project licensing split:
Tff7b72- project-owned portions: 0BSD
Tff7b72- original upstream MeshChat portions: MIT
See [Ta5d6ff`../LICENSE`](../LICENSE) for full text and notices.
──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────